UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u2AjV42XefZsuVxW1coAbvBbfjxygqQ8aJeTh97upx8='
WHERE
key_id = '20ce64e08b6498603563095fa0db98f3bcfb194a9febab1194c1493821de97ec'
AND (
token = 'u2AjV42XefZsuVxW1coAbvBbfjxygqQ8aJeTh97upx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)