UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h5FlBvqY8TDscbXc1XYWhr88sPWeCxGspNZDLUCzwN8='
WHERE
key_id = '5017292244b2ecb1d51e5ce3589b301b6fbb0030ec4cea69d487f90c7691a0cd'
AND (
token = 'h5FlBvqY8TDscbXc1XYWhr88sPWeCxGspNZDLUCzwN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)