UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nIGmHrJjviUiE2o1X3w0uFKbmnOpF4GA3le62dfrNIQ='
WHERE
key_id = '7e7a324edeb428d04e02d7af111b82a0fc3dd970c8e98b8df9fe1e62d010c3b9'
AND (
token = 'nIGmHrJjviUiE2o1X3w0uFKbmnOpF4GA3le62dfrNIQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)