UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bdRsI0QsIOsf1btAgvgJwJk6ie1NBjg+9yAnE4yw8yk='
WHERE
key_id = 'a01053f6a0b26b6f2a86417a9244e6e4c086dba777373b7129f8caae411c551b'
AND (
token = 'bdRsI0QsIOsf1btAgvgJwJk6ie1NBjg+9yAnE4yw8yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)