UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kq358CpzXvvsmRsMIqeMekAxVVnFUtn4SOl0zsQVXS8='
WHERE
key_id = '16e055cac372dc894837172409a7fd7f9a859a6eb37f4acfa42f4b259fc5eca2'
AND (
token = 'kq358CpzXvvsmRsMIqeMekAxVVnFUtn4SOl0zsQVXS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)