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