UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PNi4CJjYWyqkYlvCfktUd4oDJMkVemo8rPz4HA1bSZ8='
WHERE
key_id = '43b5f7de564449de29959fa6c6b1e0d757539d942995d9ab26e6b7268a07d10b'
AND (
token = 'PNi4CJjYWyqkYlvCfktUd4oDJMkVemo8rPz4HA1bSZ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)