UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+QtpOZJxRYRhItIRzMSYPsjWUYVvVzeoZCS0B+KSwQU=' 
WHERE 
  key_id = '764f343730c71684ad6486b705c13fa1a39c7a2b2bf44112829c6a51d4b35db5' 
  AND (
    token = '+QtpOZJxRYRhItIRzMSYPsjWUYVvVzeoZCS0B+KSwQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038