UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PgedVv3yPi4rDqLEKlAGSRQBecbIlbaBWNUkdPZu3lk='
WHERE
key_id = '5a5ffe9acde7cea1d171aaefe44be66a780f4f1220c605ba9e856db1823cec7f'
AND (
token = 'PgedVv3yPi4rDqLEKlAGSRQBecbIlbaBWNUkdPZu3lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)