UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gl8pYrtaPkRyb4CpZcs7xizVdxIttgf3RzVXhLE60X8='
WHERE
key_id = 'ed68a280480e9316a8f6884f5c314c74837df88323b2b645e6854fe7291ebadb'
AND (
token = 'gl8pYrtaPkRyb4CpZcs7xizVdxIttgf3RzVXhLE60X8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)