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