UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mmKAnpOKqQRBS+NhGOPon5GYHZapwhczxYaS3DAZrdc='
WHERE
key_id = 'edb9a0d8e55624be35da1173347f4697010c996b0335210f01635639d8c02e51'
AND (
token = 'mmKAnpOKqQRBS+NhGOPon5GYHZapwhczxYaS3DAZrdc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)