UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fF/byq82zSj+BYheOTZ2tESsA6LNJqSZlRmas+bsB0s='
WHERE
key_id = '1c7ddc90a9c7094cc5340f8a3dc59b7ca2db24105a45f40775af23369ef50f21'
AND (
token = 'fF/byq82zSj+BYheOTZ2tESsA6LNJqSZlRmas+bsB0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)