UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XDUGkmibiGh+5RV35Aq6Iq+zlk1OKTVJYD/7ZgXn5Ic='
WHERE
key_id = '4bf6aab5a47cc22ee3ce921f855fa565c0723a1ba83354735cf7f16349083a05'
AND (
token = 'XDUGkmibiGh+5RV35Aq6Iq+zlk1OKTVJYD/7ZgXn5Ic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)