UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MF8HEhijNNyX2yksuQdLBuQfEulLY0wPHS8a5cPEm/g='
WHERE
key_id = 'e5a41e5d81bdbf074760a967d399030fea1344e8589633d693c9de50e0b3eb57'
AND (
token = 'MF8HEhijNNyX2yksuQdLBuQfEulLY0wPHS8a5cPEm/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)