UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A6D7npnxi6PPTtCmxBq2H6bDGw/vDPFjM3Kty3XDouU='
WHERE
key_id = 'c56452d308d1a2de1cfdf861e0d86487074b89baa7ba64f1e347f0bb288695fb'
AND (
token = 'A6D7npnxi6PPTtCmxBq2H6bDGw/vDPFjM3Kty3XDouU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)