UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cCBw5LyixuJgJiVFFTYKP4fB8iJN5G2OjIkvPzHB9Rs=' 
WHERE 
  key_id = '7a015bf678e59d6be53fb15a6f4c5de12693931b16a0e6ed3725f118b88c1e20' 
  AND (
    token = 'cCBw5LyixuJgJiVFFTYKP4fB8iJN5G2OjIkvPzHB9Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042