UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CtkTQF4iNSZoCHdM1tnP2uf+v1QduL4jVHiCAS8NqR4='
WHERE
key_id = 'ba7146ce2186c1d89fdd37631bf8bc2a074def8ee11751ba1e798f432c9be1fe'
AND (
token = 'CtkTQF4iNSZoCHdM1tnP2uf+v1QduL4jVHiCAS8NqR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)