UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G0xZyEQKCoTZuEmy0Hf3C5fh6na7NEQv4hL1lf+V0yI='
WHERE
key_id = '1e487caeea71254c11125fc263a1c4b9f56261bcaaa1e9ac653f82aa1e667b5f'
AND (
token = 'G0xZyEQKCoTZuEmy0Hf3C5fh6na7NEQv4hL1lf+V0yI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)