UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sp5lb7Y1IYzvVHGsmYvDmxutJI9Jc9cCrSXB85XIXBw='
WHERE
key_id = '6a5ec4b46a2b7df9c7b86d913f57b0fc8c3b5f832a712aa15bd21843285535dd'
AND (
token = 'Sp5lb7Y1IYzvVHGsmYvDmxutJI9Jc9cCrSXB85XIXBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)