UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZVZCs1wGLe4nSk78TraPSqzPHzssUK3qq5MZfgOtiD8='
WHERE
key_id = '583c50dbc3fb456bd00f788bb0a793885b3c63ef4aa65d1850209735711f9ba5'
AND (
token = 'ZVZCs1wGLe4nSk78TraPSqzPHzssUK3qq5MZfgOtiD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)