UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SeMKRbyyi1OyjWGW03+dLJrJ94DUe3bkibsWg/KwqHc=' 
WHERE 
  key_id = 'b0c04fd792ee1f46fdded50f192fa2c922a9d4c0febbf93779e6a29060eb3922' 
  AND (
    token = 'SeMKRbyyi1OyjWGW03+dLJrJ94DUe3bkibsWg/KwqHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024