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