UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ip08SR5EiSO4S3zjkgoRXJNtenEny1PUdhzH8YwTsZ8='
WHERE
key_id = '8797ff2b85be3fc40789cb8bc72d3a4cd5259e7dc1d7e4a523a00f36f30cc06d'
AND (
token = 'Ip08SR5EiSO4S3zjkgoRXJNtenEny1PUdhzH8YwTsZ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)