UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kUP2HJfmpVMiYGcDZgFUd6gvkvRizogA4v93AkFz3aE='
WHERE
key_id = '0ecebaa294b7b79e30895a1d7f7ff98b4d0064c805b336208e3c0f421e84a4ab'
AND (
token = 'kUP2HJfmpVMiYGcDZgFUd6gvkvRizogA4v93AkFz3aE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)