UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+/cGMvmYkKGUoohpzzvFYqVDWmYyJrUSEG+BXUqH/I=' 
WHERE 
  key_id = 'e7d87eadd436f04491a38129b45b39291a1006d1834ef7a4ebdf746a2ca9bf7d' 
  AND (
    token = '5+/cGMvmYkKGUoohpzzvFYqVDWmYyJrUSEG+BXUqH/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025