UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b0Sg0On1XLBjJAVpw9cXw1a/QeGgFH6U6JFAXmxcttg=' 
WHERE 
  key_id = '8f0e8b9398aac4de24677972d804321632e9ca56e96416051f9c247327d0e2d9' 
  AND (
    token = 'b0Sg0On1XLBjJAVpw9cXw1a/QeGgFH6U6JFAXmxcttg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040