UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VG0oLGxA5mdFLIFcURIgIbeSNVLGt3O1EI80tZLeCyI='
WHERE
key_id = '139d1cc4076710abbe5172439c13781d5725bf5d0b7114761d43836cb52549ae'
AND (
token = 'VG0oLGxA5mdFLIFcURIgIbeSNVLGt3O1EI80tZLeCyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)