UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8EFPER2A5wQ9/SOeAFli7LgWX77cJMTr3B1Z707Wnw=' 
WHERE 
  key_id = '4ebe32ef9e9e548a45d273d44b0211e5a23cda96be129058765aa814b2f19275' 
  AND (
    token = 'p8EFPER2A5wQ9/SOeAFli7LgWX77cJMTr3B1Z707Wnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040