UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g18iyAIaiL+0uw+QKTzJHZ2xn5ppnqJuExgLxl5vKzI='
WHERE
key_id = 'b039e1e3af8e610f8d545f2edf4c285b237a4575f3c1cdc90f48f4581d39357b'
AND (
token = 'g18iyAIaiL+0uw+QKTzJHZ2xn5ppnqJuExgLxl5vKzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)