UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oIowZF+3POrPhRxtJvpYl0bMrzbELLI/p1d8TdbQOas=' 
WHERE 
  key_id = '59af7f100b3eab9b45f6832968787fc605b47e3964bb90dbf16182be09f1aef8' 
  AND (
    token = 'oIowZF+3POrPhRxtJvpYl0bMrzbELLI/p1d8TdbQOas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024